package com.situ.yB2C.product.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.situ.yB2C.product.dao.ProductDao;
import com.situ.yB2C.product.pojo.Product;
import com.situ.yB2C.product.service.ProductService;
@Service
public class ProductServiceImpl implements ProductService {

	@Autowired
	private ProductDao productDao;
	
	@Override
	public int saveProduct(Product product) {
		System.out.println(product.toString());
		product.setActiveFlag(1);
		product.setCreateBy("admin");
		product.setCreateDate(new Date());
		return productDao.insert(product);
	}

	@Override
	public List<Product> findAllProduct() {
		
		return productDao.selectList();
	}

	@Override
	public Product findOneById(Long rowId) {
		return productDao.selectOneById(rowId);
	}

	@Override
	public int deleteProductById(Long rowId) {
		return productDao.delete(rowId);
	}

	@Override
	public int updateByProductInfo(Product product) {
		return 0;
	}

}
